package com.sgrape.packageinstaller;

import android.content.Context;

import java.io.File;
import java.io.IOException;

public class PackageInstaller {
    private static PackageInstaller instance;
    private Context context;

    private PackageInstaller(Context context) {
        if (context == null)
            throw new NullPointerException("context must be not NULL");
        this.context = context.getApplicationContext();
    }

    public void installFormFile(File file) throws IOException {
        FileUtil.copyFile(file, FileUtil.createTempApk(context));
    }


    public void resume() {

    }

    public void destory() {
        context = null;
    }

    public synchronized static PackageInstaller getInstance(Context context) {
        if (instance == null) instance = new PackageInstaller(context);
        return instance;
    }
}
